let t = require;
let e = module
let o = e.exports;
o.default = e.exports;

'use strict';
console.log("start");
var _n54,
    i =
        (this && this.__extends) ||
        ((_n54 = function n(t, e) {
            return (_n54 =
                Object.setPrototypeOf ||
                ({
                    __proto__: []
                }
                    instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) {
                        Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                    }
                })(t, e);
        }),
            function (t, e) {
                function o() {
                    this.constructor = t;
                }
                _n54(t, e),
                    (t.prototype =
                        null === e ?
                            Object.create(e) :
                            ((o.prototype = e.prototype), new o()));
            }),
    r =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var i,
                r = arguments.length,
                a =
                    r < 3 ?
                        e :
                        null === n ?
                            (n = Object.getOwnPropertyDescriptor(e, o)) :
                            n;
            if (
                'object' ==
                (typeof Reflect === 'undefined' ?
                    'undefined' :
                    typeof (Reflect)) &&
                'function' == typeof Reflect.decorate
            )
                a = Reflect.decorate(t, e, o, n);
            else
                for (var s = t.length - 1; s >= 0; s--) {
                    (i = t[s]) &&
                        (a = (r < 3 ? i(a) : r > 3 ? i(e, o, a) : i(e, o)) || a);
                }
            return r > 3 && a && Object.defineProperty(e, o, a), a;
        };
Object.defineProperty(o, '__esModule', {
    value: !0
}),
    (o.BuyVitPanel = void 0);
var a = t('UIPanel'),
    s = t('UIViewRes'),
    c = t('UILayer'),
    l = t('ComUtils'),
    u = t('SoundMrg'),
    h = t('BagMrg'),
    p = t('GeneralTips'),
    f = t('PlayerMrg'),
    d = t('GameSDK'),
    g = t('UIMrg'),
    _ = t('ConstantCfg'),
    y = t('UmaSdkHelper'),
    C = t('Logger'),
    m = t('LangCfg'),
    v = cc._decorator,
    b = v.ccclass,
    M =
        (v.property,
            (function (t) {
                function e() {
                    return (null !== t && t.apply(this, arguments)) || this;
                }
                return (
                    i(e, t),
                    (e.prototype.onInit = function () {
                        t.prototype.onInit.call(this),
                            (this._anim = this.view.getComponent(cc.Animation)),
                            (this._txtDiamondTime = l.default.getComponent(
                                cc.RichText,
                                this.view,
                                'root/btnDiamond/txtTime'
                            )),
                            (this._txtAdVideoTime = l.default.getComponent(
                                cc.RichText,
                                this.view,
                                'root/btnAdVideo/txtTime'
                            )),
                            (this._txtDiamondVit = l.default.getComponent(
                                cc.Label,
                                this.view,
                                'root/btnDiamond/Background/item/txtCount'
                            )),
                            (this._txtAdVideoVit = l.default.getComponent(
                                cc.Label,
                                this.view,
                                'root/btnAdVideo/Background/item/txtCount'
                            )),
                            (this._txtPrice = l.default.getComponent(
                                cc.Label,
                                this.view,
                                'root/btnDiamond/Background/price/layout/txtPrice'
                            )),
                            l.default
                                .getNode(this.view, 'root/btnClose')
                                .on(
                                    cc.Node.EventType.TOUCH_END,
                                    this.onTouchCloseHandler,
                                    this
                                ),
                            l.default
                                .getNode(this.view, 'root/btnDiamond')
                                .on(
                                    cc.Node.EventType.TOUCH_END,
                                    this.onTouchBuyHandler,
                                    this
                                ),
                            l.default
                                .getNode(this.view, 'root/btnAdVideo')
                                .on(
                                    cc.Node.EventType.TOUCH_END,
                                    this.onTouchAdHandler,
                                    this
                                );
                        var e = _.ConstantCfg.ins.getValues(8),
                            o = _.ConstantCfg.ins.getValues(9);
                        (this._txtDiamondVit.string = 'x' + e[1].toString()),
                            (this._txtPrice.string = e[2].toString()),
                            (this._txtAdVideoVit.string = 'x' + o[1].toString());
                    }),
                    (e.prototype.onShow = function () {
                        t.prototype.onShow.call(this),
                            this._anim.play('DefShowView'),
                            this.refresh();
                    }),
                    (e.prototype.onClose = function () {
                        t.prototype.onClose.call(this);
                    }),
                    (e.prototype.onLang = function () {
                        var t = l.default.getComponent(
                            cc.Label,
                            this.view,
                            'root/title/txtTitle'
                        );
                        (t.string = m.LangCfg.ins.getContent(201100)),
                            ((t = l.default.getComponent(
                                cc.Label,
                                this.view,
                                'root/btnAdVideo/Background/price/layout/txtPrice'
                            )).string = m.LangCfg.ins.getContent(201101)),
                            this.refresh();
                    }),
                    (e.prototype.refresh = function () {
                        (this._txtDiamondTime.string =
                            '<outline color=#166E83 width=3>' +
                            m.LangCfg.ins.getContent(201102, {
                                n: f.PlayerMrg.ins.moneyBuyPowerCount
                            }) +
                            '</outline>'),
                            (this._txtAdVideoTime.string =
                                '<outline color=#C57F04 width=3>' +
                                m.LangCfg.ins.getContent(201102, {
                                    n: f.PlayerMrg.ins.adBuyPowerCount
                                }) +
                                '</outline>');
                    }),
                    (e.prototype.onTouchBuyHandler = function () {
                        if (
                            (u.SoundMrg.click(), f.PlayerMrg.ins.moneyBuyPowerCount > 0)
                        ) {
                            var t = _.ConstantCfg.ins.getValue(8, 2);
                            h.BagMrg.ins.getCount(h.BagMrg.DIAMOND) < t ?
                                p.GeneralTips.notEnoughDiamond() :
                                (h.BagMrg.ins.useItem(h.BagMrg.DIAMOND, t),
                                    C.Logger.log(_.ConstantCfg.ins.getValue(8, 1)),
                                    (f.PlayerMrg.ins.power += _.ConstantCfg.ins.getValue(
                                        8,
                                        1
                                    )),
                                    f.PlayerMrg.ins.moneyBuyPower(),
                                    g.UIMrg.close(this),
                                    y.default.buyVit(y.UmaSdkGainType.Diamond));
                        } else p.GeneralTips.show(m.LangCfg.ins.getContent(1007));
                    }),
                    (e.prototype.onTouchAdHandler = function () {

                        if (!l.default.getNode(this.view, 'root/btnAdVideo').getComponent(cc.Button).interactable)
                            return;
                        u.SoundMrg.click();

                        d.default.videoAdBuy(
                            3,
                            '体力',
                            this.onAdVideoHandler,
                            this
                        );
                        y.default.buyVit(y.UmaSdkGainType.AdVideo)

                        // if (f.PlayerMrg.ins.adBuyPowerCount > 0) {

                        // } else {
                        //     p.GeneralTips.show(m.LangCfg.ins.getContent(1007));
                        // }
                    }),
                    (e.prototype.onAdVideoHandler = function () {
                        (f.PlayerMrg.ins.power += _.ConstantCfg.ins.getValue(9, 1)),
                            f.PlayerMrg.ins.adBuyPower(),
                            g.UIMrg.close(this);
                    }),
                    (e.RES = new s.UIViewRes(
                        'BuyVitView',
                        'BuyVit',
                        c.UILayer.PopLayer
                    )),
                    r([b('BuyVitPanel')], e)
                );
            })(a.default));
(o.BuyVitPanel = M), console.log("end");
module.exports = e.exports;